{% extends "base.html" %} {% block main %}
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <h1>web聊天室</h1>
            <div class="alert alert-danger">加入聊天室之前请先登陆</div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><span class="glyphicon glyphicon-user"></span>请登陆（选择你喜欢的头像，并给自己起个昵称吧）：</h3>
                </div>
                <div class="panel-body">
                    <form action="/signin" method="post">
                        <div class="form-group">
                            <label>头像：
                                <select name=imgid class="form-control"
                                        onchange="document.images['idface'].src='/static/images/'+options[selectedIndex].value+'.jpg';">
                                    {% for imgid in range(maximgid) %}
                                    <option value="{{imgid}}" {% if imgid==random_img_id %} selected {% end %}>头像{{imgid}}
                                    </option>
                                    {% end %}
                                </select>
                            </label>
                            <img src="/static/images/{{random_img_id}}.jpg" id=idface>

                            <br/>
                            <label>昵称：</label>
                            <input type="text" name="name" class="form-control" placeholder="你的昵称" value="{{ name }}">
                            <p class="help-block">你的昵称</p>
                        </div>
                        <button type="submit" class="btn btn-primary">登陆</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% end %}